package conf

import (
	"gitee.com/llakcs/agile-go/log"
	"gitee.com/llakcs/aglie-layout/data/mq"
)

type RabbitMqConf struct {
	ConnUrl string `mapstructure:"connUrl"`
}

func LoadRabbitmq(conf *RabbitMqConf) {
	if conf.ConnUrl == "" {
		//没有redis配置返回空
		log.Info("No rabbitmq configuration information available")
		return
	}
	r, err := mq.NewRabbitMQ(conf.ConnUrl)
	if err != nil {
		log.Error(err)
		return
	}
	mq.SetGlobalMq(r)
	log.Info("RabbitMq ConnUrl: ", conf.ConnUrl)
	log.Info("RabbitMq component is initialized")
}
